<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    账号:<input type="text" class="zh"><br>
    密码:<input type="text" class="mm"><br>
    <button class="dl">登录</button>
    <button class="yzm">获取验证码</button>
</body>
</html>
<script>
    var a=Math.random()
    var zh=document.querySelector(".zh")
    var mm=document.querySelector(".mm")
    var dl=document.querySelector(".dl")
    var yzm=document.querySelector(".yzm")
    yzm.onclick=function(){
        var aa=parseInt(a*1000000)
        aaa=0
        if(aa>99999){
            aaa=aa
            alert(aaa)
        }else{
            aaa=aa+'0'
            alert(aaa)
        }
    }
    dl.onclick=function(){
        if(mm.value==aaa){
            alert('登陆成功')
        }else{
            alert('登录失败')
        }
    }
</script>